using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Audio;
using Dude_Platformer.Weapon;

namespace Dude_Platformer
{
    public class ChaseBehavior : Behavior
    {
        private Entity entityToChase;

        public ChaseBehavior(Enemy entity, Entity entityToChase)
            : base(entity)
        {
            this.entityToChase = entityToChase;
        }

        public override void Update(GameTime gameTme)
        {
            if (!Entity.IsDying)
            {
                Entity.isShooting = true;
                if (entityToChase.Position.X < Entity.Position.X)
                {
                    Entity.Direction = FaceDirection.Left;
                }
                else
                {
                    Entity.Direction = FaceDirection.Right;
                }
                Entity.Gun.Fire(Entity.Level, AmmoType.EnemyAmmo, Entity.Position, Entity.Direction);
            }
        }
    }
}
